package net.csdn.business.common.oauth2.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.csdn.business.common.oauth2.model.entity.OauthAuthLog;
import net.csdn.business.common.domain.request.oauth.OauthAuthLogQuery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * 应用授权明细Mapper接口
 * 
 * @author zhangyl
 * @date 2022-11-16
 */
@Repository
public interface OauthAuthLogMapper extends BaseMapper<OauthAuthLog>
{


    /**
     * 根据clientId、userName、authDate查询此用户当前授权的次数
     *
     * @param query 应用授权明细
     * @return 应用授权明细集合
     */
    @Select("<script> select count(*) from oauth_auth_log " +
            "where client_id= #{query.clientId} " +
            "and user_name= #{query.userName} " +
            "and auth_date= #{query.authDate} " +
            "</script>")
    public Integer selectOauthAuthLogCount(@Param("query") OauthAuthLogQuery query);


}
